package com.itheima.demo1exception;

import java.util.Scanner;

//尝试最外层捕获异常 并重新修复
public class ExceptionDemo5 {
    public static void main(String[] args) {
        System.out.println("欢迎来到购物系统");
      while(true){
          try {
              double price =show();
              System.out.println("商品价格是："+price);
              break;
          } catch (Exception e) {
              System.out.println("输入异常 请重新输入");
          }
      }
    }
    public static double show()
    {
        System.out.println("请输入商品价格");
        Scanner sc = new Scanner(System.in);
        double  price = sc.nextDouble();
        return price;
    }
}
